package com.example.administrator.rxjavademo;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

/**
 * Created by ytf on 2019/3/25 025.
 * Description:
 */
public class VG1 extends ViewGroup
{
    public VG1(Context context)
    {
        super(context);
    }

    public VG1(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        for (int i = 0; i < getChildCount(); i++)
        {
            View v = getChildAt(i);
            measureChild(v, widthMeasureSpec, heightMeasureSpec);
        }
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b)
    {
        View v = getChildAt(0);
        int w = v.getMeasuredWidth();
        int h = v.getMeasuredHeight();
        v.layout(0, 0, w, h);
    }
}
